package durose.system.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import durose.system.mapper.DeptMapper;
import durose.system.pojo.Dept;
import durose.system.pojo.DeptExample;
import durose.system.service.DeptService;

@Service
public class DeptServiceImpl implements DeptService {
	@Autowired
	DeptMapper mapper;
	
	@Override
	public int deptAdd(Dept pojo) {
		return mapper.insert(pojo);
	}

	@Override
	public void deptDelete(int id) {
		mapper.deleteByPrimaryKey(id);
	}

	@Override
	public void deptUpdate(Dept pojo) {
		mapper.updateByPrimaryKey(pojo);
	}

	@Override
	public Dept deptGet(int id) {
		return mapper.selectByPrimaryKey(id);
	}

	@Override
	public List<Dept> deptList(String queryName) {
		DeptExample example = new DeptExample();
		example.createCriteria().andDept_nameLike('%'+queryName+'%');
		return mapper.selectByExample(example);
	}
}
